/**
 *
 * @param table {Table}
 * @param auth {boolean} 接口是否需要鉴权
 * @param spare {boolean} 是否在生成代码时注释该方法，用于备用
 * @returns {string}
 */
const importPackage = (table, auth = false, spare = false) => {
  const {
    pkg,
    names: {
      TabName,
      JavaName,
      pkgName
    }
  } = table
  return `
import ${pkg}.business.${pkgName}.entity.*;
import ${pkg}.business.${pkgName}.entity.Q${TabName};

import com.utils.enums.Limit;
import com.utils.util.Dates;
import com.alibaba.fastjson.JSON;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import com.google.common.collect.ObjectArrays;
import com.querydsl.core.QueryResults;
import com.querydsl.core.types.dsl.BooleanExpression;
import com.querydsl.core.types.Expression;
import com.querydsl.core.types.Projections;
import com.querydsl.jpa.impl.JPAQueryFactory;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.util.CollectionUtils;
import com.support.mvc.entity.IWhere;
import com.support.mvc.entity.base.Page;
import java.util.*;
import java.util.function.Consumer;
import java.util.stream.Collectors;

import static com.utils.util.Dates.Pattern.yyyyMMddHHmmss;
import static com.utils.util.Dates.Pattern.yyyyMMddHHmmssSSS;
import static ${pkg}.config.init.AppInit.getQueryFactory;
`
}
export const importPackageOpenInstall = table => importPackage(table)
export const importPackageOpenUninstall = table => importPackage(table, false, true)

export const importPackageAuthInstall = table => importPackage(table, true, false)
export const importPackageAuthUninstall = table => importPackage(table, true, true)
